# 定义图书类
class Book:
    # 构造方法：在通过类实例化对象，自动调用
    def __init__(self, title, price, pub):
        self.title = title
        self.price = price
        self.pub = pub
        # print('属性添加成功')
    def __str__(self):
        # 必须返回一个字符串形式d
        return f'{self.title} {self.price} {self.pub}'
    def __call__(self):
        print('对象调用成功~')

if __name__ == '__main__':
    b1 = Book('Python', 49.9, '中信出版社')
    print(b1)
    b1()


